import request from '@/utils/request'

export async function basicsInfo(params: any) {
  return request('/api/merchant/basicsInfo', {
    method: 'GET',
    params
  })
}

export async function updateShopInfo(data: any) {
  return request('/api/merchant/updateShopInfo', {
    method: 'POST',
    data
  })
}

export async function getQrcode(params: any) {
  return request('/api/merchant/getQrcode', {
    method: 'GET',
    params
  })
}

export async function updateAlipayInfo(data: any) {
  return request('/api/merchant/updateAlipayInfo', {
    method: 'POST',
    data
  })
}

export async function saveSignInfo(data: any) {
  return request('/api/merchant/saveSignInfo', {
    method: 'POST',
    data
  })
}

export async function saveShopRentRate(data: any) {
  return request('/api/merchant/saveShopRentRate', {
    method: 'POST',
    data
  })
}

// 商户列表
export async function merchantList<T>(params: T) {
  return request('/api/platform/merchantList', {
    method: 'GET',
    params,
  });
}

// 商户详情
export async function merchantInfo(params: { id: number }) {
  return request('/api/platform/merchantInfo', {
    method: 'GET',
    params,
  });
}

// 保存商户
export async function updateMerchant<T>(data: T) {
  return request('/api/platform/updateMerchant', {
    method: 'POST',
    data,
  });
}

// 新增商户
export async function addSettle<T>(data: T) {
  return request('/api/platform/addSettle', {
    method: 'POST',
    data,
  });
}

// 商户启用状态变更   status: 1启用 2禁用
export async function updateStatus(data: { id: number, status: number }) {
  return request('/api/platform/updateStatus', {
    method: 'POST',
    data,
  });
}